'''
Created on 09.08.2010

@author: Valiuh Anton - valiuh@gmail.com
'''

from pygame import *
import Image
import ImageDraw


class GameObj(object):
	'''
		This class using for initialization and move graphic
		object in game. 
		
		vome() - calculate a new position of grahic object. It control 
			by some magic numerics:
				273 - K_UP
				274 - K_DOWN
				276 - K_LEFT
				275 - K_RIGHT
				0 - NULL
		
	'''
#==============================================================
	def __init__(self, img, x, y, step):
		self.img = img 
		self.x = x 
		self.y = y
		self.step = step 
		self.pos = img.get_rect().move(x, y)
#=============================================================        
	def move(self, event):
		'''
			Calculate a new position of grahic object. It control 
			by some magic numerics:
				273 - K_UP
				274 - K_DOWN
				276 - K_LEFT
				275 - K_RIGHT
				0 - NULL
		'''
		if event == 273: #273-K_UP
			self.pos = self.pos.move(0,-self.step)
		if event == 274: #274-K_DOWN
			self = self.pos.move(0,self.step)
		if event == 276: #276-K_LEFT
			self.pos = self.pos.move(-self.step,0)
		if event == 275: #275-K_RIGHT
			self.pos = self.pos.move(self.step,0)  
		if event == 0: #0-NULL
			pass
		